package framework.common;


/**
 * センサーの各端子に対応した操作の要求を表す。
 *
 * @author uehara
 *
 */
public class SensorRequest extends SensorMessage {
	public static final int GET = 1; // read
	public static final int SET = 2; // write
	public static final int DIR = 3; // query

	private int command; // 読み取り(GET) or 書き込み(SET)

	public SensorRequest(int command, String attr, Object value) {
		super(attr, value);
		this.command = command;
	}

	public SensorRequest() {
		super();
	}

	public int getCommand() {
		return command;
	}

	public void setCommand(int command) {
		this.command = command;
	}

	@Override
	public String toString() {
		switch (command) {
		case GET:
			return "{get:" + super.toString() + "}";
		case SET:
			return "{set:" + super.toString() + "}";
		case DIR:
			return "{dir:" + super.toString() + "}";
		default:
			return "{undef:" + super.toString() + "}";
		}
	}

}
